//
//  TodayDetailTopViewController.m
//  SYiDaiy
//
//  Created by dllo on 16/9/18.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TodayDetailTopViewController.h"
#import "TAMacro.h"
@interface TodayDetailTopViewController ()<UICollectionViewDataSource>

@end

@implementation TodayDetailTopViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self createtopCollection];
}


    
    


- (void)createtopCollection
{
    _flow = [UICollectionViewFlowLayout new];
    CGFloat width = (SCREEN_WIDTH - 40) / 3;
    _flow.itemSize = CGSizeMake(width, width);
    _flow.minimumInteritemSpacing = 10;
    _flow.minimumLineSpacing = 10;
    _flow.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
    _flow.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    _topCollection = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH / 375 * 160) collectionViewLayout:_flow];
    _topCollection.dataSource = self;
    _topCollection.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_topCollection];
    [_topCollection registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"TodayTopCustomViewCell"];
}



- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TodayTopCustomViewCell" forIndexPath:indexPath];
    UIImageView *topImageView = [[UIImageView alloc] initWithFrame:cell.bounds];

    [topImageView sd_setImageWithURL:[NSURL URLWithString:_entry_imgsArray[indexPath.row]]];
    [cell addSubview:topImageView];
    return cell;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return _entry_imgsArray.count;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
